
import { post, get, put, del } from '@/http/index'
import type { TradeMark, TradeMarkResponseData } from './type'
enum API {
  TRADEMARK_URL = '/admin/product/baseTrademark/',
  ADDTRADEMARK_URL = '/admin/product/baseTrademark/save',
  UPDATETRADEMARK_URL = '/admin/product/baseTrademark/update',
  DELETE_URL = '/admin/product/baseTrademark/remove/',
}

//获取品牌列表
export const reqHasTradeMark = (page: number = 1) =>{
  return get<any, TradeMarkResponseData>(API.TRADEMARK_URL + `${page}/5`)
}
//添加与修改已有品牌接口方法
export const reqAddOrUpdateTrademark = (data: TradeMark) => {
  if (data.id) {
    return put<any, any>(API.UPDATETRADEMARK_URL, data)
  } else {
    return post<any, any>(API.ADDTRADEMARK_URL, data)
  }
}
//删除某一个已有品牌的数据
export const reqDeleteTrademark = (id: number) =>{
  return del<any, any>(API.DELETE_URL+ id)

}
